#pragma once

#include <vector>
#include <map>
#include "Pointer.h"
#include "HashedString.h"
#include "IComponent.h"

class Entity
{
public:
	typedef std::vector<Pointer<Entity>> Vector_t;
	typedef std::map<HashedString, Pointer<Entity>> Map_t;
	typedef std::pair<HashedString, Pointer<Entity>> Pair_t;
	
	~Entity();

	void RegisterComponent( HashedString name, Pointer<IComponent>& component );
	void UnregisterComponent( HashedString name );
	IComponent* FindComponent( HashedString name );
	Pointer<IComponent>& FindComponentSmtPtr( HashedString name );
	void DestroyAllComponents();
	IComponent::Map_t& Components();

	void ReceiveMessage( IMessage* message );
private:
	IComponent::Map_t m_components;
	Entity* m_parent;
};